package com.lanchetech.dao;
import java.util.Collection;
import java.util.Date;

import com.lanchetech.bean.request.ListByTimeReq;import com.lanchetech.bean.request.RelationshipReq;import com.lanchetech.bean.response.RelationshipResp;import com.lanchetech.bean.vo.GroupVO;import com.lanchetech.bean.vo.UserDirectPushStatisticsVO;import com.lanchetech.bean.vo.UserRelationshipVO;import com.lanchetech.entity.UserRelationship;
import org.apache.ibatis.annotations.Mapper;import org.apache.ibatis.annotations.Param;import java.util.List;

@Mapper
public interface UserRelationshipMapper {
    int deleteByPrimaryKey(Long id);

    int insert(UserRelationship record);

    int insertSelective(UserRelationship record);

    UserRelationship selectByPrimaryKey(Long id);

    int updateByPrimaryKeySelective(UserRelationship record);

    int updateByPrimaryKey(UserRelationship record);

    UserRelationship findOneBySuperiorIdAndSubordinateId(@Param("superiorId") Long superiorId, @Param("subordinateId") Long subordinateId);

    UserRelationship findOneBySubordinateId(@Param("subordinateId") Long subordinateId);

    List<RelationshipResp> findAllPage(RelationshipReq req);

    List<RelationshipResp> findAllPageLeftIdentity(RelationshipReq req);

    Long countBySuperiorId(@Param("superiorId") Long superiorId);

    GroupVO getUserGroupCount(ListByTimeReq req);

    int updateSubordinateLevelBySubordinateId(@Param("updatedSubordinateLevel") Integer updatedSubordinateLevel, @Param("subordinateId") Long subordinateId);

    List<UserRelationshipVO> getUserGroupList(ListByTimeReq req);

    Long findSuperiorIdBySubordinateId(@Param("subordinateId") Long subordinateId);

    UserRelationship findOneBySubordinateIdAndStatus(@Param("subordinateId") Long subordinateId, @Param("status") Byte status);

    UserRelationship findOneBySuperiorIdAndStatus(@Param("superiorId")Long superiorId,@Param("status")Byte status);

    List<UserDirectPushStatisticsVO> getUserDirectPushNumberStatistics(@Param("superiorId") Long superiorId);

    Long countBySuperiorIdAndTime(@Param("superiorId")Long superiorId,@Param("startTime")Date startTime,@Param("endTime")Date endTime);

    Long countBySuperiorIdAndStatus(@Param("superiorId")Long superiorId,@Param("status")Byte status);

    List<UserRelationship> findAllBySubordinateIdIn(@Param("subordinateIdCollection")Collection<Long> subordinateIdCollection);




}